package com.htu.hdfs;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class CopyToLocalFile {
	 public static void main(String[] args) throws IOException, URISyntaxException {  
	        Configuration conf = new Configuration();  
	        String hdfsPath = "hdfs://localhost:9000";
	        FileSystem hdfs = FileSystem.get(new URI(hdfsPath), conf);
	        String from_HDFS = "/hdfstest/sample_data";
	        String to_Linux = "/data/hadoop4/copytolocal";
	        hdfs.copyToLocalFile(false, new Path(from_HDFS), new Path(to_Linux));
	        System.out.println("Finish!");
	    }
}
